/**
 *  CC 4.0 BY-SA
 * link：https://blog.csdn.net/chubu3218/article/details/123920304
 *
 * modified by kevin
 */

#ifndef JsonDataCom_H
#define JsonDataCom_H

#include <QObject>
#include <QVariant>
#include <QVariantList>

/**
 * @brief Json Data Item
 *
 */
struct JsonDataItem {
    JsonDataItem() {
        disUp   = 0.0;
        disDown = 0.0;
        spdUp   = 0.0;
        spdDown = 0.0;
    }
    double disUp;
    double disDown;
    double spdUp;
    double spdDown;
};
/**
 * @brief Json Data Component
 *
 */
class JsonDataCom : public QObject {
    Q_OBJECT;

public:
    JsonDataCom();

public: // to QML
    Q_INVOKABLE QVariantList getData() const;

    Q_INVOKABLE int readData();

    Q_INVOKABLE int saveData(QVariantList bgData);

public: // normal
    void dump();

private:
    QVariantList m_bgDataVec; //
};

#endif // JsonDataCom_H
